﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Police.App_Start
{
    public class OwnActionFilter : ActionFilterAttribute
    {       /// <summary>
        /// 在action method之前执行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //filterContext.HttpContext.Response.Write("方法名称：OnActionExecuting<br/>");
            ////输出请求的控制器与action名称
            //String controllerName = filterContext.RouteData.Values["controller"].ToString();
            //String actionName = filterContext.RouteData.Values["action"].ToString();
            //String message = String.Format("控制器:{0}<br/>action:{1}<br/>", controllerName, actionName);
            //filterContext.HttpContext.Response.Write(message);
            //filterContext.HttpContext.Response.Write("------------------华丽的分割线------------------<br>");
        }
        /// <summary>
        /// 在action method之后执行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            //filterContext.HttpContext.Response.Write("方法名称：OnActionExecuted<br/>");
            ////输出请求的控制器与action名称
            //String controllerName = filterContext.RouteData.Values["controller"].ToString();
            //String actionName = filterContext.RouteData.Values["action"].ToString();
            //String message = String.Format("控制器:{0}<br/>action:{1}<br/>", controllerName, actionName);
            //filterContext.HttpContext.Response.Write(message);
            //filterContext.HttpContext.Response.Write("------------------华丽的分割线------------------<br/>");
        }

        /// <summary>
        /// 在返回view之前执行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnResultExecuting(ResultExecutingContext filterContext)
        {
            //filterContext.HttpContext.Response.Write("方法名称：OnResultExecuting<br/>");
            ////输出请求的控制器与action名称
            //String controllerName = filterContext.RouteData.Values["controller"].ToString();
            //String actionName = filterContext.RouteData.Values["action"].ToString();
            //String message = String.Format("控制器:{0}<br/>action:{1}<br/>", controllerName, actionName);
            //filterContext.HttpContext.Response.Write(message);
            //filterContext.HttpContext.Response.Write("------------------华丽的分割线------------------<br/>");
        }

        /// <summary>
        /// 在返回View之后执行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            //filterContext.HttpContext.Response.Write("方法名称：OnResultExecuted<br/>");
            ////输出请求的控制器与action名称
            //String controllerName = filterContext.RouteData.Values["controller"].ToString();
            //String actionName = filterContext.RouteData.Values["action"].ToString();
            //String message = String.Format("控制器:{0}<br/>action:{1}<br/>", controllerName, actionName);
            //filterContext.HttpContext.Response.Write(message);
            //filterContext.HttpContext.Response.Write("------------------华丽的分割线------------------<br/>");
        }
    }
}